home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / Table / Sources / Content.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  7.1 KB  |  245 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Content.h
  4. //    Release Version:    $ ODF 2 $ 
  5. //
  6. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef CONTENT_H
  11. #define CONTENT_H
  12.  
  13. #ifndef FWCONTNG_H
  14. #include "FWContng.h"
  15. #endif
  16.  
  17. #ifndef CELL_H
  18. #include "Cell.h"
  19. #endif
  20.  
  21. #ifndef CONSTANT_H
  22. #include "Constant.h"
  23. #endif
  24.  
  25. #ifndef PROXY_H
  26. #include "Proxy.h"
  27. #endif
  28.  
  29. //========================================================================================
  30. //    Forward Declarations
  31. //========================================================================================
  32.  
  33. class CTablePart;
  34. class CTableProxy;
  35. class FW_CView;
  36. class FW_CMouseEvent;
  37.  
  38. //========================================================================================
  39. //    class CTablePartContent
  40. //========================================================================================
  41.  
  42. class CTablePartContent : public FW_CEmbeddingContent
  43. {
  44.   public:
  45.   
  46.     FW_DECLARE_AUTO(CTablePartContent)
  47.     
  48.     friend class CTableProxysIterator;
  49.     
  50. //----------------------------------------------------------------------------------------
  51. //    Initialization/Destruction
  52. //
  53. public:    
  54.     CTablePartContent(Environment* ev, CTablePart* part);
  55.     virtual ~CTablePartContent();
  56.  
  57. //----------------------------------------------------------------------------------------
  58. //    Inherited API
  59. //
  60.     virtual void                    ExternalizeKind(Environment* ev,
  61.                                             ODStorageUnit* storageUnit, 
  62.                                             FW_CKind* kind,
  63.                                             FW_StorageKinds storageKind,
  64.                                             FW_CPromise* promise,
  65.                                             FW_CCloneInfo* cloneInfo);
  66.     virtual FW_Boolean                InternalizeKind(Environment* ev,
  67.                                             ODStorageUnit* storageUnit, 
  68.                                             FW_CKind* kind,
  69.                                             FW_StorageKinds storageKind,
  70.                                             FW_CCloneInfo* cloneInfo);
  71.                                                       
  72.     virtual FW_MProxy*                IsDataOnlyOneProxy(Environment* ev) const;
  73.                                     
  74. //----------------------------------------------------------------------------------------
  75. //    New API
  76. //
  77. public:
  78.     // ----- Hit testing -----
  79.     ETableLoc                HitTest(Environment* ev, 
  80.                                  const FW_CMouseEvent& theMouseEvent,
  81.                                  FW_CView* view,
  82.                                   CCell& cell) const;
  83.     ETableLoc                HitTest(Environment* ev, 
  84.                                   const FW_CPoint& where,
  85.                                   CCell& cell) const;
  86.  
  87.     // ----- Resizing -----
  88.     void                Resize(Environment* ev, 
  89.                                 const CCell& cell, 
  90.                                 ETableLoc tl, 
  91.                                 const FW_CPoint& delta);
  92.     void                UpdateExtent(Environment* ev);                      
  93.     
  94.     // ----- Add/Remove proxys -----
  95.     void                AddProxy(CTableProxy* proxy);
  96.     void                RemoveProxy(CTableProxy* proxy);
  97.     void                DeleteProxy(Environment* ev, const CCell& cell);
  98.  
  99.     // ----- Getters/setters -----
  100.     const CCell&        GetMaxRowCol() const
  101.                             {return fMaxRowCol;}
  102.     
  103.     FW_Fixed            GetCellSize(short c, FW_XYSelector direction) const;
  104.     FW_Fixed            GetWidth (short c) const;
  105.     FW_Fixed            GetHeight(short r) const;
  106.     
  107.     void                SetWidth (short c, FW_Fixed w);
  108.     void                SetHeight(short r, FW_Fixed h);
  109.     
  110.     // ----- Coordinates from cell -----
  111.     void                FindCell(const FW_CPoint& where, CCell& cell) const;
  112.     
  113.     FW_Fixed            FindLocation(short c, FW_XYSelector direction) const; 
  114.     FW_Fixed            FindLeft(short col) const;
  115.     FW_Fixed            FindTop (short row) const;
  116.     
  117.     void                FindRect(const CCell& cell,
  118.                                  FW_CRect& rect)  const;
  119.                           
  120.     // ----- Cell -> proxy
  121.     CTableProxy*        CellToProxy(const CCell& cell) const;
  122.  
  123.     FW_CPoint            GetExtent() const
  124.                             {return fExtent;}
  125.     
  126.                             
  127.     void                AllocateArrays();
  128.     void                DisposeArrays();
  129.                         
  130. //----------------------------------------------------------------------------------------
  131. //    Data Members
  132. //
  133. protected:
  134.     CTablePart*                                fTablePart;
  135.     CTableProxyCollection*                    fProxys;
  136.     
  137.     // ----- Current size in memory -----
  138.     CCell                                    fMaxRowCol;        
  139.     FW_CPoint                                fExtent;
  140.     
  141.     // ----- Width and height of cells -----
  142.     FW_Fixed*                                fWidth;
  143.     FW_Fixed*                                fHeight;
  144. };
  145.  
  146. //========================================================================================
  147. // class CTableProxysIterator
  148. //========================================================================================
  149.  
  150. class CTableProxysIterator : public CTableProxyCollectionIterator
  151. {
  152. public:
  153.     FW_DECLARE_AUTO(CTableProxysIterator)
  154.     
  155.     CTableProxysIterator(CTablePartContent* content) :
  156.         CTableProxyCollectionIterator(content->fProxys){}
  157.     ~CTableProxysIterator() {}
  158. };
  159.  
  160. //========================================================================================
  161. //    class CTableSelectionContent
  162. //========================================================================================
  163.  
  164. class CTableSelectionContent : public FW_CEmbeddingContent
  165. {
  166.   public:
  167.   
  168.     FW_DECLARE_AUTO(CTableSelectionContent)
  169.     
  170. //----------------------------------------------------------------------------------------
  171. //    Initialization/Destruction
  172. //
  173. public:    
  174.     CTableSelectionContent(Environment* ev, CTablePart* part, CTablePartContent* content);
  175.     virtual ~CTableSelectionContent();
  176.  
  177. //----------------------------------------------------------------------------------------
  178. //    Inherited API
  179. //
  180. public:    
  181.     virtual FW_MProxy*        IsDataOnlyOneProxy(Environment* ev) const;
  182.  
  183.     virtual void            ExternalizeKind(Environment* ev,
  184.                                         ODStorageUnit* storageUnit, 
  185.                                         FW_CKind* kind,
  186.                                         FW_StorageKinds storageKind,
  187.                                         FW_CPromise* promise,
  188.                                         FW_CCloneInfo* cloneInfo);
  189.  
  190.     virtual FW_Boolean        InternalizeKind(Environment* ev,
  191.                                         ODStorageUnit* storageUnit, 
  192.                                         FW_CKind* kind,
  193.                                         FW_StorageKinds storageKind,
  194.                                         FW_CCloneInfo* cloneInfo);
  195.  
  196.     virtual void            SingleEmbeddedFrameInternalized(Environment* ev, 
  197.                                         FW_CEmbeddingFrame* scopeFrame,
  198.                                         ODPart* embeddedPart, 
  199.                                         ODFrame* embeddedFrame,
  200.                                         ODShape* suggestedShape,
  201.                                         ODTypeToken viewType);
  202.  
  203.     virtual ODShape*        AcquireSuggestedFrameShape(Environment* ev);
  204.  
  205. //----------------------------------------------------------------------------------------
  206. //    New API
  207. //
  208. public:    
  209.     // ----- Getters/Setters -----
  210.     CCell                    GetCell() const;
  211.     void                    SetCell(const CCell& cell);
  212.  
  213.     CTableProxy*            GetSelectedProxy(Environment* ev) const;
  214.     
  215. //----------------------------------------------------------------------------------------
  216. //    Data Members
  217. //
  218. private:
  219.     CTablePartContent*        fTableContent;
  220.     CTablePart*                fTablePart;
  221.     CCell                    fCell;    
  222. };
  223.  
  224. //========================================================================================
  225. //    Inlines
  226. //========================================================================================
  227.  
  228. //----------------------------------------------------------------------------------------
  229. //    CTableSelectionContent::GetCell
  230. //----------------------------------------------------------------------------------------
  231. inline CCell CTableSelectionContent::GetCell() const
  232. {
  233.     return fCell;
  234. }
  235.  
  236. //----------------------------------------------------------------------------------------
  237. //    CTableSelectionContent::SetCell
  238. //----------------------------------------------------------------------------------------
  239. inline void CTableSelectionContent::SetCell(const CCell& cell)
  240. {
  241.     fCell = cell;
  242. }
  243.  
  244.  
  245. #endif